package ServerDB;

import org.hibernate.Session;
/**
 * Manager of folders in DB
 * @author Guy & Liel
 *
 */
public class FolderManager 
{
	private Session session=null;
	
	/**
	 * Constructor of Folder Mangaer
	 * @param session
	 */
	public FolderManager(Session session)
	{
		if(session==null)
		{
			throw new RuntimeException("Invalid session object");
		}
		this.session=session;
	}
	/**
	 * Save a new folder in DB
	 * @param folder
	 */
	public void saveFolder(Folder folder)
	{
		session.save(folder);
	}
	/**
	 * Update an exist folder in DB
	 * @param folder
	 */
	public void updateFolder(Folder folder)
	{
		session.update(folder);
	}
	/**
	 * Delete folder from DB
	 * @param folder
	 */
	public void deleteFolder(Folder folder)
	{
		session.delete(folder);
	}
}
